//
//  VTUserCenterNetworkAPIMananger.m
//  ITBE
//
//  Created by ITBE on 2019/2/25.
//  Copyright © 2019 ITBE. All rights reserved.
//

#import "ITUserCenterNetworkAPIManager.h"

@implementation ITUserCenterNetworkAPIManager
+(instancetype)shareManager
{
    static ITUserCenterNetworkAPIManager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[ITUserCenterNetworkAPIManager alloc] init];
    });
    return manager;
}

/**用户信息*/
- (void)getMemberInfo:(NSString *)memberId callback:(APIRequstCallBack)callback{
    NSString *uri = @"/member/";
    if (memberId.length>0) {
        uri = [uri stringByAppendingString:memberId];
    }
    [[ITNetWorkRequestManager shareManager] get:uri parameters:nil callback:callback isNotify:NO];
}

- (void)editMemberInfoWithParams:(NSDictionary *)params callback:(APIRequstCallBack)callback
{
    [[ITNetWorkRequestManager shareManager] put:VT_Member_EditMemberInfo_API parameters:params callback:callback isNotify:YES];
}

- (void)requestSts:(int)type callback:(void (^)(NSDictionary *response))callback
{
    NSString *uri = type == 0 ? VT_Member_STSAuthetication_API : VT_Member_STSAutheticationUpload_API;
    [[ITNetWorkManager defaultManager] get:uri parameters:nil callback:^(ITNetWorkModel *ret) {
        int statusCode = [ret.data intValueForKey:@"StatusCode" default:0];
        if (statusCode != 200) {
            callback(nil);
        }else {
            callback(ret.data);
        }
    }];
}
@end
